package utility;


import java.sql.ResultSet;
import dbmanager.DBManager;
import dbmanager.GetIdName;

public class AddProperty 
{
	DBManager db = new DBManager();
	GetIdName gin;
	String property, value;
	public AddProperty() 
	{
		db.getConnect();
		gin = new GetIdName(db);
	}
	void setProperty(String property, String value)
	{
		this.property = gin.getId(property);
		this.value = gin.getId(value);
	}
	void add(String object)
	{
		try 
		{
			ResultSet rs = db.getSelect("Select mid from property_details where pid="+gin.getId("type")+" and pv="+gin.getId(object));
			while(rs.next())
			{
				String mid = rs.getString("mid");
				db.getInsert("insert into property_details (mid,pid,pv,vt,ref) values("+mid+","+property+","+value+",'no$','0')");
			}
		} 
		catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	public static void main(String[] args) 
	{
		AddProperty add = new AddProperty();
		add.setProperty("group", "supplier");
		add.add("supplier");
	}

}
